package com.master.service;

import com.master.dao.UserDao;
import com.master.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by lee on 2018/2/27.
 */


@Service
public class UserService {

  @Autowired
  private UserDao userDao;


  @Transactional(propagation = Propagation.REQUIRES_NEW,
          isolation = Isolation.READ_COMMITTED,
          timeout = 3)
  public void updateUser() {
    System.out.println("111111111");
    User user = new User();
    user.setName("jaasadweada");
    user.setScore(992);
    user.setUser_id(5);
    userDao.update(user);
    System.out.println("2222222222");
  }
}
